package com.sali.utils.exception;


import com.sali.utils.result.IResultCode;

public class BusinessException extends RuntimeException{
    // ErrorHandler === R 答案：不想破坏R类。
    // 异常的状态码，从枚举中获得
    private final Integer code;
    // 异常的消息，写用户看得懂的异常，从枚举中得到
    private final String msg;

    public BusinessException(IResultCode resultCode){
       super(resultCode.getMsg());
       this.code = resultCode.getCode();
       this.msg = resultCode.getMsg();
    }

    public BusinessException(Integer code,String msg){
        super(msg);
        this.code = code;
        this.msg = msg;
    }


    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
